void init_terminal();

void put_cursor_at(int x, int y);
void put_character_at(char c, int x, int y, u8int foreground, u8int background);
void scroll_buffer(char c, u8int foreground, u8int background);
void fill_buffer(char c, u8int foreground, u8int background);
u16int vidmem_char_for(char c, u8int foreground, u8int background);
void go_text_mode();

void put_char(char c);
void put_string(char* c);
void put_dec(u32int i);
void put_padded_dec(u32int d, int padding);
void put_hex(u32int i);
void put_padded_hex(u32int d, int padding);
void put_bool(bool b);

void clear();
void endl();

void set_fgbg(u8int foreground, u8int background);
output_colors get_colors();
void set_colors(output_colors colors);
void set_cursor(int x, int y);
void get_cursor(int* x, int* y);
void dec_cursor();
void inc_cursor();
void preserve_cursor();
void restore_cursor();
void preserve_colors();
void restore_colors();
void preserve_formatting();
void restore_formatting();
void preserve_buffer();
void restore_buffer();

void printf(char* control_string, ...);
void* argumentLocation(int i);
char* stringArgumentNumber(int i);
int intArgumentNumber(int i);
char charArgumentNumber(int i);

void debug_isr_stack(isr_stack stack);
void debug_normal_isr_stack(isr_stack stack);
void debug_v86_isr_stack(isr_stack stack);
void draw_character(char** character);
void stack_dump(int rows, u32int* location);

extern void go_text();
extern void go_text_end();

// consider qualifying video_memory as "volatile"
static u16int* video_memory = (u16int*)0xB8000;
static u16int video_buffer[80*25];
static int cursor_x = 0;
static int cursor_y = 0;
static output_colors preserved_colors;
static int preserved_x;
static int preserved_y;
void* arguments_start;
static u8int foreground = 0xF;
static u8int background = 0x0;
static char* rhinovirus[13] = {
	"       .  ---  .",
	"     .           .",
	"  /                 \\",
	"  .        /        .  " ,
	" .    _   |    _     .",
	"|    /  \\  \\  /  \\    |",
	" |   \\ _/  /  \\ _/   |",
	"|         |           |",
	" .         \\         .",
	"  .        /        .",
	"  \\       |          /",
	"     .             .",
	"       .  _____  .",
};
